package com.qf.web;

import com.qf.service.StudentService;
import com.qf.service.impl.StudentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;

/**
 * 2019/11/11
 * Administrator
 * spring1111
 * 面向对象面向君  不负代码不负卿
 */
//@Component("myservlet")
@Controller("myservlet")
@Scope(value = "prototype")
public class StudentServlet {

  /*  public StudentServlet() {
        System.out.println("servlet()");
    }
    public StudentServlet(String name,int age){
        System.out.println("servlet(name,age)="+name+","+age);
    }

    public StudentServlet(String name,String age){
        System.out.println("servlet(name,String age)="+name+","+age);
    }

    public static StudentServlet staticMethod(){
        System.out.println("staticMethod");
        return  new StudentServlet();
    }


    public void a(){
        System.out.println("servlet初始化方法");
    }

    public void b(){
        System.out.println("销毁方法");
    }*/

  @PostConstruct
  public void a(){
      System.out.println("init-a");
  }
  @Autowired   //默认的自动注入的方式是byType
    private StudentService studentService;
    public void test(){
        System.out.println("servlet被调动");
        studentService.insert();
    }

}
